package com.zyx.wanshu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zyx.wanshu.entity.RoleMenu;
import com.zyx.wanshu.mapper.RoleMenuMapper;
import com.zyx.wanshu.service.IRoleMenuService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zyx
 * @since 2022/7/15 22:22
 */
@Service
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements IRoleMenuService {
    @Override
    public List<RoleMenu> queryList(RoleMenu roleMenu) {
        LambdaQueryWrapper<RoleMenu> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(roleMenu.getMenuId() != null, RoleMenu::getMenuId, roleMenu.getMenuId())
                .eq(roleMenu.getRoleId() != null, RoleMenu::getRoleId, roleMenu.getRoleId());
        return this.list(queryWrapper);
    }
}
